HAL OPAMP constants migration

This section provides information about the HAL OPAMP constants migration.

HAL OPAMP factory trimming options constants

HAL1

HAL2

#define OPAMP_FACTORYTRIMMING_DUMMY
#define OPAMP_FACTORYTRIMMING_N
#define OPAMP_FACTORYTRIMMING_P

Removed ; used internally in HAL1 and had no impact on user-level operations.


HAL OPAMP mode constants

HAL1

HAL2



#define OPAMP_STANDALONE_MODE
#define OPAMP_PGA_MODE
#define OPAMP_FOLLOWER_MODE
typedef enum
{
  HAL_OPAMP_MODE_STANDALONE,
  HAL_OPAMP_MODE_PGA,
  HAL_OPAMP_MODE_FOLLOWER
} hal_opamp_config_mode_t;

Related concepts:


HAL OPAMP inverting input selections constants

HAL1

HAL2



#define OPAMP_INVERTINGINPUT_IO0
#define OPAMP_INVERTINGINPUT_IO1
#define OPAMP_INVERTINGINPUT_CONNECT_NO
typedef enum
{
  HAL_OPAMP_INVERTING_INPUT_GPIO_0,
  HAL_OPAMP_INVERTING_INPUT_GPIO_1,
  HAL_OPAMP_INVERTING_INPUT_NO_EXT_CON
} hal_opamp_inverting_input_t;

Related concepts:


HAL OPAMP non-inverting input selections constants

HAL1

HAL2



#define OPAMP_NONINVERTINGINPUT_DAC
#define OPAMP_NONINVERTINGINPUT_DAC_CH

#define OPAMP_NONINVERTINGINPUT_IO0
#define OPAMP_NONINVERTINGINPUT_IO1
#define OPAMP_NONINVERTINGINPUT_IO2
#define OPAMP_NONINVERTINGINPUT_IO3
typedef enum
{
  HAL_OPAMP_NON_INVERTING_INPUT_DAC,


  HAL_OPAMP_NON_INVERTING_INPUT_GPIO_0,
  HAL_OPAMP_NON_INVERTING_INPUT_GPIO_1,
  HAL_OPAMP_NON_INVERTING_INPUT_GPIO_2,
  HAL_OPAMP_NON_INVERTING_INPUT_GPIO_3
} hal_opamp_non_inverting_input_t;

Related concepts:


HAL OPAMP PGA gain settings (including negative gains) constants

HAL1

HAL2



#define OPAMP_PGA_GAIN_2
#define OPAMP_PGA_GAIN_4
#define OPAMP_PGA_GAIN_8
#define OPAMP_PGA_GAIN_16
typedef enum
{
  HAL_OPAMP_PGA_GAIN_2,
  HAL_OPAMP_PGA_GAIN_4,
  HAL_OPAMP_PGA_GAIN_8,
  HAL_OPAMP_PGA_GAIN_16
} hal_opamp_pga_gain_t;

Related concepts:


HAL OPAMP power mode options constants

HAL1

HAL2

In HAL1, set of defines is provided to represent both speed ( NORMAL / HIGH) and power ( NORMAL / LOW) .

In HAL2, there are two different enumerations:

  • hal_opamp_power_mode_t to select the power mode (NORMAL or LOW).

  • hal_opamp_speed_mode_t to select the speed mode (NORMAL or HIGH).

OPAMP power_mode

#define OPAMP_POWERMODE_NORMAL
// or
#define OPAMP_POWERMODE_NORMALPOWER

#define OPAMP_POWERMODE_LOWPOWER


OPAMP speed_mode

#define OPAMP_POWERMODE_NORMALSPEED
#define OPAMP_POWERMODE_HIGHSPEED


The following defines are present in certain STM32 series


#define OPAMP_POWERMODE_LOWPOWER_HIGHSPEED



#define OPAMP_POWERMODE_LOWPOWER_NORMALSPEED



#define OPAMP_POWERMODE_NORMALPOWER_HIGHSPEED



#define OPAMP_POWERMODE_NORMALPOWER_NORMALSPEED
typedef enum
{
  HAL_OPAMP_POWER_MODE_NORMAL,


  HAL_OPAMP_POWER_MODE_LOW
} hal_opamp_power_mode_t;


typedef enum
{
  HAL_OPAMP_SPEED_MODE_NORMAL,
  HAL_OPAMP_SPEED_MODE_HIGH
} hal_opamp_speed_mode_t;


Select HAL_OPAMP_POWER_MODE_LOW from hal_opamp_power_mode_t and HAL_OPAMP_SPEED_MODE_HIGH from hal_opamp_speed_mode_t.


Select HAL_OPAMP_POWER_MODE_LOW from hal_opamp_power_mode_t and HAL_OPAMP_SPEED_MODE_NORMAL from hal_opamp_speed_mode_t.


Select HAL_OPAMP_POWER_MODE_NORMAL from hal_opamp_power_mode_t and HAL_OPAMP_SPEED_MODE_HIGH from hal_opamp_speed_mode_t.


Select HAL_OPAMP_POWER_MODE_NORMAL from hal_opamp_power_mode_t and HAL_OPAMP_SPEED_MODE_NORMAL from hal_opamp_speed_mode_t.

Related concepts:


HAL OPAMP power supply options constants

HAL1

HAL2



#define OPAMP_POWERSUPPLY_HIGH
#define OPAMP_POWERSUPPLY_LOW
typedef enum
{
  HAL_OPAMP_POWER_SUPPLY_LOW,
  HAL_OPAMP_POWER_SUPPLY_HIGH
} hal_opamp_power_supply_range_t;

Related concepts:


HAL OPAMP trimming options constants

HAL1

HAL2



#define OPAMP_TRIMMING_FACTORY
#define OPAMP_TRIMMING_USER
typedef enum
{
  HAL_OPAMP_TRIMMING_MODE_FACTORY,
  HAL_OPAMP_TRIMMING_MODE_USER
} hal_opamp_trimming_mode_t;

Related concepts:


HAL OPAMP pga gain with negative gain options constants

HAL1

HAL2



#define OPAMP_PGA_GAIN_2_OR_MINUS_1
#define OPAMP_PGA_GAIN_4_OR_MINUS_3
#define OPAMP_PGA_GAIN_8_OR_MINUS_7
#define OPAMP_PGA_GAIN_16_OR_MINUS_15
...
typedef enum
{
  HAL_OPAMP_PGA_GAIN_2_OR_MINUS_1,
  HAL_OPAMP_PGA_GAIN_4_OR_MINUS_3,
  HAL_OPAMP_PGA_GAIN_8_OR_MINUS_7,
  HAL_OPAMP_PGA_GAIN_16_OR_MINUS_15,
  ...
} hal_opamp_pga_gain_t;

Related concept: Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels.


HAL OPAMP timer controlled mux mode options constants

HAL1

HAL2



#define OPAMP_TIMERCONTROLLEDMUXMODE_DISABLE
#define OPAMP_TIMERCONTROLLEDMUXMODE_TIM1_CH6
#define OPAMP_TIMERCONTROLLEDMUXMODE_TIM2_CH6
#define OPAMP_TIMERCONTROLLEDMUXMODE_TIM8_CH6
#define OPAMP_TIMERCONTROLLEDMUXMODE_TIM12_CH6
#define OPAMP_TIMERCONTROLLEDMUXMODE_TIM15_CH6
#define OPAMP_TIMERCONTROLLEDMUXMODE_TIM20_CH6
...
typedef enum
{
  HAL_OPAMP_MUX_INPUT_CTRL_DISABLE,
  HAL_OPAMP_MUX_INPUT_CTRL_TIM1_OC6,
  HAL_OPAMP_MUX_INPUT_CTRL_TIM2_OC4,
  HAL_OPAMP_MUX_INPUT_CTRL_TIM8_OC6,
  HAL_OPAMP_MUX_INPUT_CTRL_TIM12_OC1,
  HAL_OPAMP_MUX_INPUT_CTRL_TIM15_OC2,
  HAL_OPAMP_MUX_INPUT_CTRL_TIM20_OC6,
  ...
} hal_opamp_mux_inputs_ctrl_t;

Related concept: Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels.